﻿Public Class seg_fPermisos 



    Private Sub seg_fPermisos_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'DbFireAndIceDataSet.seg_clases' table. You can move, or remove it, as needed.
        Me.Seg_clasesTableAdapter.Fill(Me.DbFireAndIceDataSet.seg_clases)
     

    End Sub

    Private Sub guardar_Click(sender As System.Object, e As System.EventArgs) Handles guardar.Click
        Try
            Me.Seg_clasesTableAdapter.Update(DbFireAndIceDataSet)
            SeguridadSGS.DarTodosLosPermisosAlAdministrador()
            AlertControl1.AppearanceCaption.ForeColor = Color.Green
            AlertControl1.Show(Me, My.Resources.StringGlobal.msjNotificacion, My.Resources.StringGlobal.msjGuardóRegistro)
            AlertControl1.AppearanceCaption.ForeColor = Color.Orange
            AlertControl1.Show(Me, My.Resources.StringGlobal.msjNotificacion, "Recuerda que todos los permisos son otorgados automáticamente al Administrador")

        Catch ex As Exception
            AlertControl1.AppearanceCaption.ForeColor = Color.Red
            AlertControl1.Show(Me, My.Resources.StringGlobal.msjNotificacion, "Error al guardar el registro.")
            TlogTableAdapter1.InsertQueryLogs(TlogTableAdapter1.ScalarQueryCountLogs + 1, My.Forms.MDI.Iduser.Caption, My.Resources.StringGlobal.prgVinicio, "Error al actualizar el table adapter con la base de datos.", ex.Message, My.Resources.StringGlobal.mdlSeguridad, Date.Today, TimeOfDay.TimeOfDay.ToString, My.Computer.Name, Name.ToString, sender.GetType.FullName.ToString)
        End Try

    End Sub

    Private Sub Seg_clasesBindingNavigatorSaveItem_Click(sender As System.Object, e As System.EventArgs) Handles Seg_clasesBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.Seg_clasesBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.DbFireAndIceDataSet)

    End Sub

    Private Sub cancelar_Click(sender As System.Object, e As System.EventArgs) Handles cancelar.Click
        Try
            Me.Seg_clasesTableAdapter.Fill(Me.DbFireAndIceDataSet.seg_clases)
            AlertControl1.AppearanceCaption.ForeColor = Color.Green
            AlertControl1.Show(Me, My.Resources.StringGlobal.msjNotificacion, "Se cancelaron las últimas acciones correctamente.")
        Catch ex As Exception
            AlertControl1.AppearanceCaption.ForeColor = Color.Red
            AlertControl1.Show(Me, My.Resources.StringGlobal.msjNotificacion, "No se pudieron cancelar las últimas acciones.")
            TlogTableAdapter1.InsertQueryLogs(TlogTableAdapter1.ScalarQueryCountLogs + 1, My.Forms.MDI.Iduser.Caption, My.Resources.StringGlobal.prgVinicio, "Error al actualizar el table adapter con la base de datos.", ex.Message, My.Resources.StringGlobal.mdlSeguridad, Date.Today, TimeOfDay.TimeOfDay.ToString, My.Computer.Name, Name.ToString, sender.GetType.FullName.ToString)
        End Try
    End Sub

    Private Sub imprimir_Click(sender As System.Object, e As System.EventArgs) Handles imprimir.Click
        Seg_clasesGridControl.ShowPrintPreview()
    End Sub



    Private Sub SimpleButton1_Click(sender As System.Object, e As System.EventArgs) Handles SimpleButton1.Click
        Seg_clasesGridControl.ShowPrintPreview()
    End Sub
End Class